package com.example.demo.service.impl;

import com.example.demo.service.TestFeignClient;
import com.example.demo.utils.ResponseResult;
import com.example.demo.utils.ResponseResultUtil;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestParam;

@Component
public class TestFeignClientFallBackFactory implements FallbackFactory<TestFeignClient> {

    @Override
    public TestFeignClient create(Throwable cause) {
        return new TestFeignClient() {
            @Override
            public ResponseResult sendMsg(String msg) {
                System.out.println("==============TestFeignClientFallBack 熔断了====================");
                return ResponseResultUtil.fail("TestFeignClientFallBack熔断了");
            }
        };
    }
}
